﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 增加TenantCode : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "TenantCode",
                table: "SysJobPositionRole",
                type: "nvarchar(64)",
                maxLength: 64,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "TenantCode",
                table: "SysJobPosition",
                type: "nvarchar(64)",
                maxLength: 64,
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "PersonId",
                table: "SysDailyLeaveRequestBill",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "IX_SysDailyLeaveRequestBill_PersonId",
                table: "SysDailyLeaveRequestBill",
                column: "PersonId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysDailyLeaveRequestBill_SysPerson_PersonId",
                table: "SysDailyLeaveRequestBill",
                column: "PersonId",
                principalTable: "SysPerson",
                principalColumn: "ID",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysDailyLeaveRequestBill_SysPerson_PersonId",
                table: "SysDailyLeaveRequestBill");

            migrationBuilder.DropIndex(
                name: "IX_SysDailyLeaveRequestBill_PersonId",
                table: "SysDailyLeaveRequestBill");

            migrationBuilder.DropColumn(
                name: "TenantCode",
                table: "SysJobPositionRole");

            migrationBuilder.DropColumn(
                name: "TenantCode",
                table: "SysJobPosition");

            migrationBuilder.DropColumn(
                name: "PersonId",
                table: "SysDailyLeaveRequestBill");
        }
    }
}
